package com.example.bootservice.controller;

import com.example.bootservice.dto.RepayPlanFileDTO;
import com.example.bootservice.service.RepayPlanService;
import com.example.bootservice.util.ServerConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/api")
public class BootController {

    @Autowired
    private  RepayPlanService repayPlanService;

    @Autowired
    private ServerConfig serverConfig;

    @RequestMapping("insert")
     public void insert() {
        repayPlanService.insert();
     }

     @RequestMapping("select")
     @ResponseBody
     public List<RepayPlanFileDTO> select() {
         System.out.println(serverConfig.getUrl());
        return  repayPlanService.select();
     }

     @RequestMapping("insertUser")
     public void  insertUser(){
         repayPlanService.insertUser();
     }

}
